/**
 * Copyright (C), 2015-2020, XXX有限公司
 * FileName: RoleService
 * Author:   sky
 * Date:     2020/5/9 16:01
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package cn.szh.service;

import cn.szh.dao.RoleDao;
import cn.szh.domain.Role;
import cn.szh.face.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author sky
 * @create 2020/5/9
 * @since 1.0.0
 */
@Service("roleService")
public class RoleService implements IRoleService {

    @Autowired
    private RoleDao roleDao;

    public List<Role> findOtherRoleById(int id) {
        List<Role> otherRoles = roleDao.findOtherRoleById(id);
        return otherRoles;
    }

    public void addRoleToUser(int uid, int rid) {
        roleDao.addRoleToUser(uid,rid);
    }

    public List<Role> findAll() {
        List<Role> roles = roleDao.findAll();
        return roles;
    }

    public Role findById(int id){
        Role role = roleDao.findById(id);
        return role;
    }
    //新建角色
    public void addRole(String roleName,String roleDesc){
        roleDao.addRole(roleName,roleDesc);
    }
}
